package cn.m3a1.sys;

import cn.m3a1.model.Course;
import com.iceking.dynamicweb.DBConnection;
import com.iceking.dynamicweb.DWPConsole;
import com.iceking.dynamicweb.TaskProcessor;
import net.sf.json.JSONObject;

/**
 * Created by wyj on 2019-06-04.
 */
public class StuLeave extends TaskProcessor {
    /**
     * 保存用户
     * @throws Exception
     */
    public void save() throws Exception {
        JSONObject json = new JSONObject();
        Course course=new Course();
        course.setSemyear1(getParamInt("semyears1"));
        course.setSemyear2(getParamInt("semyears2"));
        course.setRoom(getParam("room"));
        course.setSemno(getParamInt("semno"));
        course.setClassid(getParamInt("classid"));
        course.setTeacherid(getParamInt("teacherid"));
        course.setTime(getParam("time"));
        course.setName(getParam("name"));

        //保存课程信息
        DBConnection connection = DWPConsole.getInstance().getOneConnection();
        connection.save(course);
        connection.close();

        json.put("succ", true);
        json.put("stmt", "添加成功");
        toJson(json.toString());

    }
}
